package com.credit.jumu.playcard.activity;

import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.view.View;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;

import com.credit.jumu.playcard.R;
import com.credit.jumu.playcard.base.BaseActivity;


/**
 * Created by Administrator on 2017/10/19/019.
 */
public class BindingCardActivity extends BaseActivity {
	TextView bindingok;
	ImageView imageIcon;
	ImageView titleback;
	TextView title;
	String type;
	LinearLayout cvnview,validity;
	TextView cvnviewline,validityline;

	public static BindingCardActivity instance = null;
	@Override
	protected void onCreate(@Nullable Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		instance = this;
		setContentView(R.layout.activity_binding_bankcard);
		Intent intent = getIntent();
		type = intent.getStringExtra("type");
		initView();
		backClick(R.id.titleback,this);
	}

	private void initView() {
		bindingok = (TextView) findViewById(R.id.bindingok);
		imageIcon = (ImageView) findViewById(R.id.imageIcon);
		imageIcon.setVisibility(View.GONE);
		titleback = (ImageView) findViewById(R.id.titleback);
		titleback.setVisibility(View.VISIBLE);
		title = (TextView) findViewById(R.id.title);

		cvnview = (LinearLayout) findViewById(R.id.cvnview);
		validity = (LinearLayout) findViewById(R.id.validity);
		cvnviewline = (TextView) findViewById(R.id.cvnviewline);
		validityline = (TextView) findViewById(R.id.validityline);
		if("addcredit".equals(type)){
			title.setText("绑定信用卡");
			bindingok.setText("下一步");
			showMore();
		}else {
			bindingok.setText("完成");
			title.setText("绑定银行卡");
		}
		bindingok.setOnClickListener(new View.OnClickListener() {
			@Override
			public void onClick(View v) {
				if ("recharge".equals(type)) {//绑定储蓄卡
					Intent intent = new Intent(BindingCardActivity.this, RechargeActivity.class);
					startActivity(intent);
				} else if ("withdrawals".equals(type)) {//充值
					Intent intent = new Intent(BindingCardActivity.this, WithdrawalsActivity.class);
					startActivity(intent);
				} else if ("binding".equals(type)) {//只是绑定
					BindingCardActivity.this.finish();
				}
				else if ("addcredit".equals(type)) {//绑定信用卡
					Intent intent = new Intent(BindingCardActivity.this, BindingCreditSureActivity.class);
					startActivity(intent);
				}
			}
		});
	}
	//显示信用卡时其他布局
	private void showMore() {
		cvnview.setVisibility(View.VISIBLE);
		validity.setVisibility(View.VISIBLE);
		cvnviewline.setVisibility(View.VISIBLE);
		validityline.setVisibility(View.VISIBLE);
	}


}
